﻿using System;
using System.Runtime.CompilerServices;
using UnityEngine;

public static class CharacterExtension
{
    public static Character GetCharacter(this Collider co)
    {
        return ((co == null) ? null : co.GetComponentInParent<Character>());
    }

    public static void PlayUseItemAnimation(this Character cha, AnimationClip clip)
    {
        Animator componentInChildren = cha.GetComponentInChildren<Animator>();
        if (componentInChildren != null)
        {
            componentInChildren.PlayOverrideClip("UseItem", clip);
        }
    }
}

